stack = [$node]; } public function enterNode(Node $node) : Node { if ($this->stack !== []) { $parentNode = $this->stack[\count($this->stack) - 1]; $node->setAttribute(PhpDocAttributeKey::PARENT, $parentNode); } $this->stack[] = $node; return $node; } /** * @return null|int|\PhpParser\Node|Node[] Replacement node (or special return */ public function leaveNode(Node $node) { \array_pop($this->stack); return null; } }